-
Notifications
You must be signed in to change notification settings - Fork 788
Make OpenAlex work #1168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make OpenAlex work #1168
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for removing the DOI prefix from OpenAlex API responses and includes a test to verify OpenAlex integration works correctly.
- Adds DOI prefix removal logic to normalize DOI format from OpenAlex responses
- Introduces a new test to verify OpenAlex provider functionality
- Adjusts whitespace formatting in the OpenAlex client code
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/test_clients.py | Imports OpenAlexProvider and adds test for OpenAlex DOI query functionality |
| src/paperqa/clients/openalex.py | Adds DOI prefix normalization to remove "https://doi.org/" prefix from OpenAlex responses and adjusts whitespace |
| tests/cassettes/test_does_openalex_work[10.1021-acs.jctc.5b00178].yaml | VCR cassette recording for the new OpenAlex test |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jamesbraza
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch
It turns out openalex never worked if you query on DOI. OpenAlex refers to DOIs always with the URL prefix (e.g., https://doi.org/10xxx/xxxxx). So when it returned articles, they had DOIs that didn't match the requested DOIs and we rejected them as failed. This fixes and adds a low-effort unit test that just checks if openalex is working.
Note
Normalize OpenAlex DOIs by removing the https://doi.org/ prefix before comparison and add a VCR test to verify DOI queries work via OpenAlexProvider.
doiby removinghttps://doi.org/prefix in API results before matching against requested DOI.OpenAlexProviderto tests and new async testtest_does_openalex_workquerying by DOI withfields=["open_access"].OpenAlex.Written by Cursor Bugbot for commit 0da01b2. Configure here.